package vn.gq.udv.comic;

import vn.gq.udv.utils.UrlHandler;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;

public class AppStoreActivity extends BaseActivity {

	private WebView mWebView;
	private String mUrl;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.webview_layout);
		mUrl = getIntent().getExtras().getString("URL");
		final ProgressBar progressBar = (ProgressBar) findViewById(R.id.loading);
		mWebView = (WebView) findViewById(R.id.webview);
		mWebView.setWebViewClient(new WebViewClient() {

			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				return new UrlHandler(AppStoreActivity.this).appURLHandler(view, url);
			}

			@Override
			public void onPageFinished(WebView view, String url) {
				mWebView.setVisibility(View.VISIBLE);
				progressBar.setVisibility(View.GONE);
				super.onPageFinished(view, url);
			}
		});
		mWebView.loadUrl(mUrl);
		
		
	}

}
